package com.handpay.nocardpay.baselibrary.notification.model.bean;

import android.os.Parcel;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * @author sxshi on 2017/4/6.
 *         email:emotiona_xiaoshi@126.com
 *         describe:Describe the function  of the current class
 */
@DatabaseTable(tableName = "t_notice")
public class NoticeBody implements android.os.Parcelable {
    @DatabaseField(generatedId = true)
    private int id;
    @DatabaseField
    private String userId;
    @DatabaseField
    private boolean isRead = false;
    @DatabaseField
    private String content;
    @DatabaseField
    private String title;
    @DatabaseField
    private String time;
    @DatabaseField
    private String noticeId;
    @DatabaseField
    private String lastUpdateTime;

    public int getId() {
        return id;
    }


    public String getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(String lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public boolean isRead() {
        return isRead;
    }

    public void setRead(boolean read) {
        isRead = read;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getNoticeId() {
        return noticeId;
    }

    public void setNoticeId(String noticeId) {
        this.noticeId = noticeId;
    }

    public NoticeBody() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NoticeBody that = (NoticeBody) o;

        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
        return noticeId != null ? noticeId.equals(that.noticeId) : that.noticeId == null;

    }

    @Override
    public int hashCode() {
        int result = userId != null ? userId.hashCode() : 0;
        result = 31 * result + (noticeId != null ? noticeId.hashCode() : 0);
        return result;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.userId);
        dest.writeByte(this.isRead ? (byte) 1 : (byte) 0);
        dest.writeString(this.content);
        dest.writeString(this.title);
        dest.writeString(this.time);
        dest.writeString(this.noticeId);
        dest.writeString(this.lastUpdateTime);
    }

    protected NoticeBody(Parcel in) {
        this.id = in.readInt();
        this.userId = in.readString();
        this.isRead = in.readByte() != 0;
        this.content = in.readString();
        this.title = in.readString();
        this.time = in.readString();
        this.noticeId = in.readString();
        this.lastUpdateTime = in.readString();
    }

    public static final Creator<NoticeBody> CREATOR = new Creator<NoticeBody>() {
        @Override
        public NoticeBody createFromParcel(Parcel source) {
            return new NoticeBody(source);
        }

        @Override
        public NoticeBody[] newArray(int size) {
            return new NoticeBody[size];
        }
    };

    @Override
    public String toString() {
        return "NoticeBody{" +
                "id=" + id +
                ", userId='" + userId + '\'' +
                ", isRead=" + isRead +
                ", content='" + content + '\'' +
                ", title='" + title + '\'' +
                ", time='" + time + '\'' +
                ", noticeId='" + noticeId + '\'' +
                ", lastUpdateTime='" + lastUpdateTime + '\'' +
                '}';
    }
}
